import React, { Component } from 'react';

class Mylist extends Component {
    constructor(porps){
        super(porps);
        this.state={
            list:[],
        }
    }
    render() {
        return (
            <div className='list'>
                <div>
                    <input type="text" placeholder='请输入今天的任务安排' ref={this.inp} />
                    <button onClick={()=>{this.add(this.inp.current)}}>添加</button>
                </div>
                <div>
                    {
                        this.state.list.map((item,index)=>{
                            return (
                                <li> {item} </li>
                            )
                        })
                    }            
                </div>
            </div>
        );
    }
    inp = React.createRef();
    add(  ){
        this.setState({
            list
        })
        
    }
}

export default Mylist;